package stru1.day8;

/**
 * 206. 反转链表
 */
public class Solution1 {

    /**
     * see alg1.day10.Solution2
     */
    public static ListNode reverseList(ListNode head) {
        if (head == null) return null;
        ListNode ans = new ListNode(head.val);
        while (head.next != null) {
            head = head.next;
            ans = new ListNode(head.val, ans);
        }
        return ans;
    }
}
